package com.design01_builder.pattern01_singleton;

/**
 * @ClassName Singleton03
 * @Description 懒汉式线程安全
 * @Author zhangjunhao
 * @DATE 2023/8/31 22:08
 */
public class Singleton03 {

    //1.构造方法
    public Singleton03() {
    }

    //2.全局静态变量
    public static  Singleton03 INSTANCE;



    //3.给方法加锁
    public static synchronized Singleton03 getINSTANCE() {
        if(INSTANCE == null) {
            return new Singleton03();
        }
        return INSTANCE;
    }
}

